// 使用最小花费爬楼梯



#include<iostream>
#include<vector>

using namespace std;

class Solution{
public:
int minCostClimbStairs(vector<int> & cost){
// 楼顶是 n

int n = cost.size();

vector<int> dp(n+1);
for (int i = 2; i <= n; i++){
    dp[i] = min(cost[i - 1], cost[i - 2]); 
    if (i < n){
        cost[i] += min(cost[i - 1], cost[i - 2]);
    }
}
return dp[n];
}
};

int main(){

    // vector<int> cost = {10, 15, 30};
    vector<int> cost = {1,100,1,1,1,100,1,1,100,1}; 
    
    Solution sol;
    int ans = sol.minCostClimbStairs(cost);
    cout << ans << endl;
}
